@mixin logo-background($navbar-color) {
    background: $navbar-color url('../images/organization_logo.png') no-repeat center center;
}

@mixin logo-background-medium($navbar-color) {
    background: $navbar-color url('../images/organization_logo_medium.png') no-repeat center center;
}

@mixin logo-background-small($navbar-color) {
    background: $navbar-color url('../images/organization_logo_small.png') no-repeat center center;
}

.logo {
    max-width: $sidebar-width;
    width: $sidebar-width;
    height: $navbar-height;
    float: left;
    @include logo-background($navbar-color);
}

@media screen and (max-width: 1366px) {
    .logo {
        max-width: 155px;
        width: 155px;
        float: left;
        @include logo-background-medium($navbar-color);
    }
}

@media screen and (max-width: 1300px) {
    .logo {
        max-width: 45px;
        width: 45px;
        float: left;
        @include logo-background-small($navbar-color);
    }
}

@media screen and (max-width: 980px) {
    .navbar-fixed-top {
        margin: 0;
        position: fixed;
    }
}

&.is-at-top .navbar {
    box-shadow: none;
}

.navbar {
    background: $navbar-color;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
    height: $navbar-height;

    & > .motd {
        background: #0e73c2;
        color: #ffffff;
        padding: 13px 10px 12px;
        text-align: center;
        font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;

        a {
            color: white;
            text-decoration: underline;
        }

        button {
            margin: 0;
        }
    }
}

@media screen and (max-width: 880px) {
    .navbar {
        height: $navbar-height * 2;
    }
}

@media screen and (max-width: 650px) {
    .navbar {
        height: $navbar-height * 3;
    }
}

.navbar .navbar-inner {
    font-family: 'SourceSansPro', Arial;
    font-size: 1.1em;
    background: $navbar-color;
    filter: none;
    border-bottom: 1px solid $dark-main;
    color: $white;
    padding: 0;
    height: $navbar-height;
    box-shadow: none;

    @media screen and (max-width: 1400px) {
        font-size: 1em;
    }
    @media screen and (max-width: 980px) {
        font-size: 0.9em;
    }

    .container-fluid {
        padding: 0;
    }

    .brand {
        padding: 0;
    }

    .nav {
        height: $navbar-height;

        & > li {
            height: $navbar-height;
        }

        & > li > a {
            color: $white;
            height: $navbar-height - 12px - 5px + 1px;
            text-shadow: 0 1px 2px lighten($dark-grey, 20%);
            padding: 12px 20px 5px;
            text-align: center;

            @media screen and (max-width: 1024px) {
                padding: 12px 15px 5px;
            }
        }

        li:hover > a, li:hover > a:hover, li:hover > a:focus,
        li.active > a, li.active > a:hover, li.active > a:focus,
        li.dropdown.active > .dropdown-toggle {
            color: $white;
            background-color: $navbar-color-hover;
            box-shadow: none;
        }

        li.dropdown > a .caret, li.dropdown > a:hover .caret, li.dropdown > a:focus .caret,
        li.dropdown.open > .dropdown-toggle .caret, li.dropdown.active > .dropdown-toggle .caret, li.dropdown.open.active > .dropdown-toggle .caret {
            border-top-color: $white;
            border-bottom-color: $white;
        }

        li.dropdown.open > .dropdown-toggle, li.dropdown.open.active > .dropdown-toggle {
            color: $white;
            background-color: $dark-grey;
            box-shadow: none;
        }

        li > a.username {
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            max-width: 250px;
        }
        @media screen and (max-width: 1250px) {
            li.user-menu {
                width: 50px;

                & > a.username {
                    width: 50px;
                    padding-left: 8px;
                }
            }
        }

        li.current-project > a {
            background-color: darken($dark-main, 5%);
            white-space: nowrap;
            overflow: hidden;
            text-align: left;
            box-sizing: border-box;
            -moz-box-sizing: border-box;
            height: $navbar-height;

            &:before {
                content: '';
            }

            i {
                margin-right: 5px;
            }
        }
        li.current-project.cutted > a {
            text-overflow: ellipsis;
            width: 180px;
        }
        li.current-project:hover > a:hover, li.current-project:focus > a:focus {
            background-color: darken($dark-main, 7%);
        }

        ul.dropdown-menu {
            top: $navbar-height - 1px;
            background-color: $dark-grey;
            border-radius: 0;
            border: none;
            min-width: 100%;
            padding: 0;

            &:before, &:after {
                content: none;
            }

            li:first-child {
                margin-top: 5px;
            }

            li:last-child {
                margin-bottom: 5px;
            }

            li > a, .submit-action {
                color: $white;
                font-size: 0.9em;
                line-height: 1.7em;
                display: block;
                padding: 3px 20px;
                clear: both;
                font-weight: normal;
                line-height: $baseLineHeight;
                white-space: nowrap;

                &:hover a {
                    text-decoration: none;
                }
            }

            li > a:hover, li > a:focus,
            .submit-action:hover, .submit-action:focus,
            .dropdown-submenu:hover > a, .dropdown-submenu:focus > a {
                background: lighten($dark-grey, 10%);
                background-image: none;
                filter: none;
                text-decoration: none;
            }

            li > form {
                margin: 0;
                display: flex;

                .submit-action {
                    background-color: transparent;
                    border: none;
                    flex-grow: 1;
                    text-align: left;
                    font-family: inherit;
                }
            }

            .divider {
                background-color: darken($dark-grey, 5%);
                border: 0;
            }
        }

        .projects-nav ul.dropdown-menu {
            max-height: 590px;
            overflow: hidden;
            width: 300px;

            #filter-projects {
                background: lighten($dark-grey, 10%);
                border-color: darken($dark-grey, 3%);
                color: $grey;
                width: 85%;
                margin: 10px auto;
                display: block;

                &:focus {
                    box-shadow: none;
                    background: lighten($dark-grey, 15%);
                }
            }
        }
    }

    .user-avatar {
        float: left;
        position: relative;
        top: -8px;
        margin: 0 10px 0 0;
        width: 36px;
        height: 36px;
        border-radius: 50%;
    }

    .navbar-search {
        margin: 8px 25px 0 0;

        input[type="text"] {
            border: 1px solid $dark-main;

            &:focus {
                box-shadow: none;
                z-index: 0;
            }
        }

        .btn {
            background-color: $dark-main;
            background-image: -moz-linear-gradient(top, lighten($dark-main, 10%), $dark-main);
            background-image: -webkit-gradient(linear, 0 0, 0 100%, from(lighten($dark-main, 10%)), to($dark-main));
            background-image: -webkit-linear-gradient(top, lighten($dark-main, 10%), $dark-main);
            background-image: -o-linear-gradient(top, lighten($dark-main, 10%), $dark-main);
            background-image: linear-gradient(to bottom, lighten($dark-main, 10%), $dark-main);
            border: 1px solid $dark-main;
            border-color: $dark-main;
            border-bottom-color: darken($dark-main, 5%);
            padding: 3px 18px 5px;

            i {
                color: #FFFFFF;
                text-shadow: 0 1px 2px lighten($dark-grey, 25%);
            }
        }

        .input-append {
            margin-bottom: 0;
        }
    }
}
